package cn.jolyoulu.adminweb.entity.vo;

import lombok.Data;
import lombok.experimental.Accessors;
import cn.jolyoulu.cmnservice.entity.po.SysOperateLog;

import java.time.LocalDateTime;
import java.util.Objects;


@Data
@Accessors(chain = true)
public class SysOperateLogVO {

    /** id */
    private String id;

    /** 用户id */
    private String nickname;

    /** 请求的方式 */
    private String reqMethod;

    /** 请求路径 */
    private String reqUrl;

    /** 请求参数 */
    private String reqParam;

    /** 调用的java方法 */
    private String operateMethod;

    /** 操作的ip地址 */
    private String operateIp;

    /** 操作地点 */
    private String operateLocation;

    /** 操作状态（0正常 1异常） */
    private Integer status;

    /** 返回参数 */
    private String jsonResult;

    /** 错误消息 */
    private String errorMsg;

    /** 操作时间 */
    private LocalDateTime operateTime;

    /** 消耗时间（毫秒） */
    private Integer costTime;

	public SysOperateLogVO(SysOperateLog sysOperateLog) {
        if (Objects.nonNull(sysOperateLog)){
            this.id = String.valueOf(sysOperateLog.getId());
            this.reqMethod = sysOperateLog.getReqMethod();
            this.reqUrl = sysOperateLog.getReqUrl();
            this.reqParam = sysOperateLog.getReqParam();
            this.operateMethod = sysOperateLog.getOperateMethod();
            this.operateIp = sysOperateLog.getOperateIp();
            this.operateLocation = sysOperateLog.getOperateLocation();
            this.status = sysOperateLog.getStatus();
            this.jsonResult = sysOperateLog.getJsonResult();
            this.errorMsg = sysOperateLog.getErrorMsg();
            this.operateTime = sysOperateLog.getOperateTime();
            this.costTime = sysOperateLog.getCostTime();
        }
    }
	
}